<include file="Public:header_new"/>
    <style>
.clearfix:before,.clearfix:after {
    content:"";
    display:table;
}
.clearfix:after {
    clear:both;
}
.clearfix {
    clear:both;
    *zoom:1;
}
.show {
    display:block!important;
}
.box {
    width:450px;
}
.ul_list {
    width:100%;
    height:32px;
    text-align: center;
}
.ul_list li {
    width:100px;
    box-sizing:border-box;
    cursor:pointer;
    font-size:22px;
    line-height: 22px;
    text-align: center;
    color:#99A6BF;
    display:inline-block;
}
.ul_list li.active {
    color:#059FF5;
}
.div_box {
    width: 450px;background:#2D2C3C;border:1px solid #2D2C3C;margin:23px auto;
}
.div_box .div_list {
    display:none;
}
.wjmm{color:#059FF5;}
.white:hover{color:#fff;}
    </style>
<div class="outlogbox">
	<div class="logbox">
		<!-- tab开始 -->
		<div class="box">
			<ul class="ul_list clearfix">
				<li class="active"><span class="white">{$Think.lang.Finance_login} </span></li>
				<li style='width:20px;'>·</li>
				<a href="{:U('Login/register')}"><li><span class="white">{$Think.lang.Finance_reg} </span></li></a>
			</ul>
			<div class="div_box">
				<div class="div_list" style="display:block;">
				<!-- 登录开始 -->
				 <form id="form-login" class="mask_wrap login-fb">
					<div class="inbox">
						<div class="boxrow">
							<div class="rightbox">
								<input id="login_username" name="username" type="text" class="iptbox" onblur="usernames();" placeholder="{$Think.lang.g_dz_yx} " />
							</div>
						</div>
						<div class="boxrow">
							<div class="rightbox">
								<input id="login_password" name="password" type="password" class="iptbox" onkeyup="chkpwd();" maxlength="16" onblur="passwords()" placeholder="{$Think.lang.User_password} " />
							</div>
						</div>
							<div class="boxrow" id="ga-box-i" style="margin-bottom:5px;">
								<div class="rightbox">
									<input type="text" class="iptbox yzm" id="login_verify" name="code" style="width: 170px; float: left;" onblur="verifys();" maxlength="6" placeholder="{$Think.lang.Finance_yzm} " />
										<img id="codeImg reloadverifyindex" src="{:U('Verify/code')}" style="width:145px;height: 40px;margin-left:10px;cursor: pointer;" onclick="this.src=this.src+'?t='+Math.random()" title="{$Think.lang.Finance_yzmhyz} " class='codeImg'>
								</div>

							</div>
							<div class="boxrow" id="ga" style="display:none">
								<div class="rightbox">
									<input id="foot_ga" type="text" placeholder="{$Think.lang.Login_wbdbs}" class="iptbox"  onblur="if(this.value == '')this.placeholder='{$Think.lang.Login_wbdbs}';" onclick="if(this.placeholder == '{$Think.lang.Login_wbdbs}')this.placeholder='';"/>
								</div>
							</div>
							<p style="text-align: right;display:inline-block;width:330px;margin-bottom:10px"> <a href="{:U('Login/findpwd')}" class="wjmm">{$Think.lang.Finance_wjmm} </a></p>
						<div class="boxrow">
							<div class="rightbox nolabel">
								<input type="button" name="index_submit" id="loginSubmin" onclick="upLogin();" class="iptbut" value="{$Think.lang.g_login} ">
							</div>
						</div>
					</div>
				</form>
				<!-- 登录结束 -->
				</div>
			</div>
		</div>
	</div>
</div>
<script>
	//记住账号
	var cookieValue=$.cookies.get('cookie_username');
	if(cookieValue!=''&&cookieValue!=null){
		$("#username").val(cookieValue);
		$("#autoLogin").attr("checked",true);
	}
	// 检测用户名
    function usernames(){
        var username = $('#login_username').val();
        if(username==""||username==null){
            layer.tips('{$Think.lang.Finance_srusn} ','#login_username',{tips:3});
            return false;
        }
        $.post("{:U('Login/jiancega')}", {
        	username:username,
        	}, function (data) {
        		if (data.status == 1) {
        			$('#ga').show();
        		}

        	}, "json");
    }

    // 检测密码
    function passwords(){
        var password = $('#login_password').val();
        if(password==""||password==null){
            layer.tips('{$Think.lang.Finance_srdlmm} ','#login_password',{tips:3});
            return false;
        }
    }
	// 检测验证码
    function verifys(){
        var verify = $('#login_verify').val();
        if(verify==""||verify==null){
            layer.tips('{$Think.lang.g_guge_put_yzm} ','#login_verify',{tips:3});
            return false;
        }
    }
	function upLogin() {
		var username = $("#login_username").val();
		var password = $("#login_password").val();
		var verify = $("#login_verify").val();
		var foot_ga = $("#foot_ga").val();
		if (username == "" || username == null) {
			layer.tips('{$Think.lang.Finance_srusn} ', '#login_username', {tips: 3});
			return false;
		}
		if (password == "" || password == null) {
			layer.tips('{$Think.lang.Finance_srdlmm} ', '#login_password', {tips: 3});
			return false;
		}

		if (verify == "" || verify == null) {
			layer.tips('{$Think.lang.g_guge_put_yzm} ', '#login_verify', {tips: 3});
			return false;
		}

		$('#loginSubmin').css('background','#135F91');

		$.post("{:U('Login/submit')}", {
			username: username,
			password: password,
			verify: verify,
			ga: foot_ga
		}, function (data) {
			if (data.status == 1) {
				$.cookies.set('cookie_username', username);
				layer.msg(data.info, {icon: 1});
				window.location = '/User/index';
				$('#loginSubmin').css('background','#135F91');
			} else {
				//刷新验证码
				//$(".reloadverifyindex").click();
				var codeImg = $(".codeImg").attr("src");
                if (codeImg.indexOf('?') > 0) {
                    $(".codeImg").attr("src",
                            codeImg + '&random=' + Math.random());
                } else {
                    $(".codeImg").attr(
                            "src",
                            codeImg.replace(/\?.*$/, '') + '?'
                            + Math.random());
                }
				layer.msg(data.info, {icon: 2});
				$('#loginSubmin').css('background','#135F91');
				if (data.url) {
					window.location = data.url;
				}
			}
		}, "json");
	}
	function chkpwd(){
		var loginpassword = $("#login_password").val();
		var patten =/^[a-zA-Z0-9]+$/;
		var match = new RegExp(patten);
		if (!match.test(loginpassword)) {
			layer.tips('{$Think.lang.Finance_mmjc} ','#login_password',{tips:3});
			var result = loginpassword.substring(0,loginpassword.length-1);
			$("#login_password").val(result);
		}
	}
	//顶部菜单高亮
	$('#menu_top_index').addClass('current');
</script>
<include file="Public:footer_new"/>